package com.yugao.fintech.antelope.pay.payment.factory;

import com.alibaba.fastjson2.JSONObject;
import com.yugao.fintech.antelope.pay.constant.IfCodeEnum;
import com.yugao.fintech.antelope.pay.payment.model.bo.IClientWrapper;
import com.yugao.fintech.antelope.pay.payment.model.params.IsvParams;
import com.yugao.fintech.antelope.pay.payment.model.params.IsvsubMchParams;
import com.yugao.fintech.antelope.pay.payment.model.params.NormalMchParams;
import com.yugao.fintech.antelope.pay.payment.model.params.alipay.AlipayIsvParams;
import com.yugao.fintech.antelope.pay.payment.model.params.alipay.AlipayIsvsubMchParams;
import com.yugao.fintech.antelope.pay.payment.model.params.alipay.AlipayNormalMchParams;
import org.springframework.stereotype.Service;

@Service
public class AliPayFactory extends AbstractPayFactory {
    @Override
    public IfCodeEnum getIfCode() {
        return IfCodeEnum.ALIPAY;
    }

    @Override
    public IClientWrapper buildClientWrapper(IsvParams isvParams) {
        return null;
    }

    @Override
    public IClientWrapper buildClientWrapper(NormalMchParams normalMchParams) {
        return null;
    }

    @Override
    public IsvParams buildIsvParams(String paramsStr) {
        return JSONObject.parseObject(aesCrypto.decrypt(paramsStr), AlipayIsvParams.class);
    }

    @Override
    public NormalMchParams buildNormalMchParams(String paramsStr) {
        return JSONObject.parseObject(aesCrypto.decrypt(paramsStr), AlipayNormalMchParams.class);
    }

    @Override
    public IsvsubMchParams buildIsvsubMchParams(String paramsStr) {
        return JSONObject.parseObject(paramsStr, AlipayIsvsubMchParams.class);
    }
}
